/*
**********************************************************************************
 ECE 527 Project 3
 Description: Implementation of 64 bit Ling's adder 

 Team : Rohit Kulkarni
        Akshay Kotian
**********************************************************************************
*/

module ling_adder_64
(
	input [63:0]  a,
	input [63:0]  b,
	input Cin,
	output reg [63:0] S,
	output reg Cout
);

reg [65:-1] t;
reg [66:0] g;
reg [66:0] h;

integer i;	

always @(*)
begin

	for(i = 0; i < 64; i=i+1)
	begin
		 	t[-1] 	 = 1;
			h[0]	 = Cin;
		 	t[i]	 = a[i] | b[i];
			g[i] 	 = a[i] & b[i];
		 	h[i+1]   = g[i] | (t[i-1] & h[i]);
		 	S[i]	 = (t[i] ^ h[i+1]) | (g[i] & h[i] & t[i-1]);
		    Cout 	 = h[i+1] & t[i] ;
	end

end
endmodule
